#ifndef _NNSLITE_OBJECT_CONTAINER_H_
#define _NNSLITE_OBJECT_CONTAINER_H_

#include "nnsliteglobal.h"
#include "nnsliteheapfile.h"
#include "nnslitebufferedheapfile.h"

struct nnsliteObjectContainerBase;

typedef struct nnsliteObjectContainer
{
	struct nnsliteObjectContainerBase* base; /* If the pointer is NULL, which indicates it is not used right now */
	nnsliteBufferedHeapFile bhf;
	u32 objCount;
	u32 containerID;
}nnsliteObjectContainer;

typedef struct nnsliteObjectContainerBase
{
	nnsliteHeapFS* heapFS;
	u32 bufSize; /* The buffer size of each container */
	u32 maxNumContainer; /* The count of containers */
	nnsliteObjectContainer containers[1];
}nnsliteObjectContainerBase;

#define nnsliteObjectContainerGet(base,id) (&(base)->containers[id])

NNSLITE_RET nnsliteObjectContainerBaseCreate(nnsliteObjectContainerBase** base, nnsliteHeapFS* heapFS, u32 maxNumContainer, u32 bufSize);
NNSLITE_RET nnsliteObjectContainerBaseFree(nnsliteObjectContainerBase* base);
NNSLITE_RET nnsliteObjectContainerBaseWrite(nnsliteObjectContainerBase* base, nnsliteBufferedHeapFile* bhf);
NNSLITE_RET nnsliteObjectContainerBaseRead(nnsliteObjectContainerBase** base, nnsliteHeapFS* heapFS, nnsliteBufferedHeapFile* bhf);


NNSLITE_RET nnsliteObjectContainerCreate(nnsliteObjectContainerBase* base, u32* newContainerID);
NNSLITE_RET nnsliteObjectContainerDelete(nnsliteObjectContainerBase* base, u32 containerID);

NNSLITE_RET nnsliteObjectContainerInsert(nnsliteObjectContainer* container, const nnsliteObject* obj);
NNSLITE_RET nnsliteObjectContainerRemove(nnsliteObjectContainer* container, u32 objID);
NNSLITE_RET nnsliteObjectContainerBeginScan(nnsliteObjectContainer* container);
NNSLITE_RET nnsliteObjectContainerNext(nnsliteObjectContainer* container, nnsliteObject* obj);
NNSLITE_RET nnsliteObjectContainerClose(nnsliteObjectContainer* container);

















#endif

